package orthoplanner.com.google.code.eventhandlers;

import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JFrame;

public class DrawableColorChooserHandler extends MouseAdapter {
	private final JFrame colorChooserFrame;
	public DrawableColorChooserHandler( JFrame colorChooserFrame) {
		this.colorChooserFrame=colorChooserFrame;
	}
	@Override
	public void mousePressed(MouseEvent e) {
		super.mousePressed(e);
		Point cp=GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
		colorChooserFrame.setVisible(true);
		colorChooserFrame.setLocation(cp.x-(colorChooserFrame.getWidth()/2),cp.y-(colorChooserFrame.getHeight()/2));
		colorChooserFrame.pack();
	}

}
